572. 另一棵树的子树
https://leetcode.cn/problems/subtree-of-another-tree/description/


相同的树，递归左树和右树
bool IsSameTree(struct TreeNode*p,struct TreeNode*q)
{
    if(p==NULL&&q==NULL)
    {
        return true;
    }
    if(p==NULL||q==NULL)
    {
        return false;
    }

    if(p->val!=q->val)
    {
        return false;
    }
    return IsSameTree(p->left,q->left)&&IsSameTree(p->right,q->right);
}


bool isSubtree(struct TreeNode* root, struct TreeNode* subRoot)
{
    if(root==NULL)
    {
        return false;
    }
    if(IsSameTree(root,subRoot))
    {
        return true;
    }

    return isSubtree(root->left,subRoot)||
    isSubtree(root->right,subRoot);

}